﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MainSite.Master" AutoEventWireup="true" CodeBehind="Notifications.aspx.cs" Inherits="BSCMFF.Web.Pages.Evaluation_Setup.Notifications" %>
<%@ Register Src="~/UserControls/Selections/EvalNotificationStartOrEnd.ascx" TagName="EvalStartOrEnd" TagPrefix="bsc" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">

<bsc:EvaluationSelection ID="EvalSelection" runat="server" ></bsc:EvaluationSelection>

<asp:Panel ID="PanelNotifications" runat="server" Visible="false">
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" >
    </telerik:RadAjaxLoadingPanel>
    <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" LoadingPanelID="RadAjaxLoadingPanel1" Width="50%">
    
    <telerik:RadGrid ID="RadGridNotifications" runat="server" Width="100%" 
        DataSourceID="EntityDataSourceEvaluationNotifications" 
        onupdatecommand="RadGridNotifications_UpdateCommand" 
        oninsertcommand="RadGridNotifications_InsertCommand" 
        ondeletecommand="RadGridNotifications_DeleteCommand">
        <MasterTableView AutoGenerateColumns="False" DataKeyNames="ID" EditMode="InPlace" CommandItemDisplay="Top"
            DataSourceID="EntityDataSourceEvaluationNotifications">
            <CommandItemSettings ExportToPdfText="Export to PDF" />
            <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">
                <HeaderStyle Width="20px" />
            </RowIndicatorColumn>
            <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column">
                <HeaderStyle Width="20px" />
            </ExpandCollapseColumn>
            <Columns>
                <telerik:GridBoundColumn DataField="ID" DataType="System.Int32" Visible="false"
                    FilterControlAltText="Filter ID column" HeaderText="ID" ReadOnly="True" 
                    SortExpression="ID" UniqueName="ID">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="Evaluation_Period_FK"  Visible="false"
                    DataType="System.Int32" 
                    FilterControlAltText="Filter Evaluation_Period_FK column" 
                    HeaderText="Evaluation_Period_FK" SortExpression="Evaluation_Period_FK" 
                    UniqueName="Evaluation_Period_FK">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="DaysBefore" DataType="System.Int32" Visible="false"
                    FilterControlAltText="Filter DaysBefore column" HeaderText="DaysBefore" 
                    SortExpression="DaysBefore" UniqueName="DaysBefore">
                </telerik:GridBoundColumn>

                <telerik:GridTemplateColumn HeaderText="Days Before" >
                    
                    <ItemTemplate>
                        <asp:Label ID="LabelDays" runat="server" Text='<%# Eval("DaysBefore") %>' ></asp:Label>
                    </ItemTemplate>
                    <EditItemTemplate>
                        <telerik:RadNumericTextBox ID="RadNumericTextBoxDays" runat="server" Value='<%# Eval("DaysBefore").ToString() == "" ? 0 : (int)Eval("DaysBefore") %>' Width="30">
                            <NumberFormat DecimalDigits="0" />
                        </telerik:RadNumericTextBox>
                    </EditItemTemplate>                    
                </telerik:GridTemplateColumn>
                
                <telerik:GridTemplateColumn HeaderText="Start or End">
                    <ItemTemplate>
                        <asp:Label ID="LabelStartOrEnd" runat="server" Text='<%# Eval("StartOrEnd") %>' ></asp:Label>
                    </ItemTemplate>
                    <EditItemTemplate>
                        <bsc:EvalStartOrEnd ID="EvaluationStartOrEnd" runat="server" PublicSelectedValue='<%# Eval("StartOrEnd") %>' >
                        </bsc:EvalStartOrEnd>
                    </EditItemTemplate>                    
                </telerik:GridTemplateColumn>

                <%--<telerik:GridBoundColumn DataField="StartOrEnd" 
                    FilterControlAltText="Filter StartOrEnd column" HeaderText="StartOrEnd" 
                    SortExpression="StartOrEnd" UniqueName="StartOrEnd">
                </telerik:GridBoundColumn>--%>
                <telerik:GridCheckBoxColumn DataField="Sent" DataType="System.Boolean" ReadOnly="true"
                    FilterControlAltText="Filter Sent column" HeaderText="Sent" 
                    SortExpression="Sent" UniqueName="Sent">
                </telerik:GridCheckBoxColumn>
                <telerik:GridEditCommandColumn UniqueName="EditButton" ></telerik:GridEditCommandColumn>
                <telerik:GridButtonColumn Text="Delete" CommandName="Delete" ></telerik:GridButtonColumn>                
            </Columns>
            
            <editformsettings editformtype="webusercontrol" usercontrolname="~/usercontrols/details/evaluationnotificationdetails.ascx">
                
                <EditColumn ButtonType="ImageButton" InsertText="Insert Order" UpdateText="Update record"
                        UniqueName="EditCommandColumn1" CancelText="Cancel edit">
                    </EditColumn>
            </editformsettings>
        </MasterTableView>
        
        <FilterMenu EnableImageSprites="False">
        </FilterMenu>
        <HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default">
        </HeaderContextMenu>
    </telerik:RadGrid>
    
</telerik:RadAjaxPanel>
    <asp:EntityDataSource ID="EntityDataSourceEvaluationNotifications" 
        runat="server" ConnectionString="name=BSCEntities" 
        DefaultContainerName="BSCEntities" EnableFlattening="False" 
        EntitySetName="Evaluation_Notifications" 
        Where="@evalID == it.Evaluation_Period_FK">
    <WhereParameters>
        <asp:ControlParameter ControlID="EvalSelection" Name="evalID" 
            PropertyName="PublicSelectedValue" DbType="Int32" DefaultValue="0" />
    </WhereParameters>
    </asp:EntityDataSource>
    <br /><br />
<telerik:RadAjaxPanel ID="RadAjaxPanel2" runat="server" LoadingPanelID="RadAjaxLoadingPanel1" Width="50%">
    <telerik:RadButton ID="RadButtonSendNotifications" runat="server" Text="Send Notifications Now" 
    OnClick="RadButtonSendNotifications_Click">
    </telerik:RadButton>
    <asp:Label ID="LabelStatus" runat="server" ></asp:Label>
</telerik:RadAjaxPanel>
</asp:Panel>
</asp:Content>
